<?php

require_once('Zend/Filter/Interface.php');

/* @todo include validations of the type of the $value */

class Cms_Filter_File_RemoveSpecialChars implements Zend_Filter_Interface 
{
	public function filter($value) 
	{
		$path_parts = pathinfo($value);
		$ext  = $path_parts['extension'];
		$filename = $path_parts['filename'];
		$filename = preg_replace('/[^a-zA-Z0-9_-]/s', '', $filename);		
		return $filename . '.' . $ext;		
	}	 
	
}
